<template>
    <div class="project-show-box">
        <v-dialog
            title="查看"
            :show.sync="dialogVisible"
            width="1200px"
            @beforeClose="beforeClose"
            :close-on-click-modal="false">
            <div class="card-box">
                <div class="card-title">工程信息</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="工程名称" prop="projectName">
                        <span class="int-text">{{showForm.projectName}}</span>
                    </el-form-item>
                    <el-form-item label="工程地址" prop="projectAddress">
                        <span class="int-text">{{showForm.projectAddress}}</span>
                    </el-form-item>
                    <el-form-item label="工程类型" prop="projectType">
                        <span class="int-text">{{getCardTypeValue(showForm.projectType,projectTypes)}}</span>
                    </el-form-item>
                </el-form>
                <div class="card-title">项目建议书信息</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="文号" prop="proposalDocument">
                        <span class="int-text">{{showForm.proposalDocument}}</span>
                    </el-form-item>
                    <el-form-item label="金额(元)" prop="proposalAmount">
                        <span class="int-text">{{showForm.proposalAmount}}</span>
                    </el-form-item>
                    <el-form-item label="审批日期" prop="proposalApprove">
                        <span class="int-text">{{showForm.proposalApprove}}</span>
                    </el-form-item>
                </el-form>
                <div class="card-title">可行性研究报告信息</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="文号" prop="feasibleDocument">
                        <span class="int-text">{{showForm.feasibleDocument}}</span>
                    </el-form-item>
                    <el-form-item label="金额(元)" prop="feasibleAmount">
                        <span class="int-text">{{showForm.feasibleAmount}}</span>
                    </el-form-item>
                    <el-form-item label="审批日期" prop="feasibleApprove">
                        <span class="int-text">{{showForm.feasibleApprove}}</span>
                    </el-form-item>
                </el-form>
                <div class="card-title">概算批复文件</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="文号" prop="estimateDocument">
                        <span class="int-text">{{showForm.estimateDocument}}</span>
                    </el-form-item>
                    <el-form-item label="金额(元)" prop="estimateAmount">
                        <span class="int-text">{{showForm.estimateAmount}}</span>
                    </el-form-item>
                    <el-form-item label="审批日期" prop="estimateApprove">
                        <span class="int-text">{{showForm.estimateApprove}}</span>
                    </el-form-item>
                </el-form>
                <div class="card-title">预算审核文件</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="文号" prop="budgetDocument">
                        <span class="int-text">{{showForm.budgetDocument}}</span>
                    </el-form-item>
                    <el-form-item label="金额(元)" prop="budgetAmount">
                        <span class="int-text">{{showForm.budgetAmount}}</span>
                    </el-form-item>
                    <el-form-item label="审批日期" prop="budgetApprove">
                        <span class="int-text">{{showForm.budgetApprove}}</span>
                    </el-form-item>
                </el-form>
                <!--<div class="card-title">创建信息</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="创建人" prop="createName">
                        <span class="int-text">{{showForm.createName}}</span>
                    </el-form-item>
                    <el-form-item label="创建时间" prop="createTime">
                        <span class="int-text">{{showForm.createTime}}</span>
                    </el-form-item>
                </el-form>-->
                <div class="card-title">附件</div>
                <div class="handling-opinions">
                    <v-upload
                        ref="informationUpload"
                        :busId="showForm.projectSetupId"
                        modelType="registration"
                        isShowFileList
                        :isView="true"
                        multiple
                        v-model="fileList"/>
                </div>
            </div>
            <div class="card-box"><el-button class="btn" type="primary" size="small" @click="shutDown()">关闭</el-button></div>
        </v-dialog>
    </div>
</template>

<script>
    import { get } from '../api/information'
    export default {
        name: "show-actual",
        mounted() {
            this.projectTypes = this.getDict("epc_project_type")
        },
        data() {
            return {
                dialogVisible: false,
                fileList: [],
                projectTypes: [],
                showForm: {
                    projectSetupId: '',
                    projectName: '',
                    projectAddress: '',
                    projectType: '',
                    proposalDocument: '',
                    proposalAmount: '',
                    proposalApprove: '',
                    feasibleDocument: '',
                    feasibleAmount: '',
                    feasibleApprove: '',
                    estimateDocument: '',
                    estimateAmount: '',
                    estimateApprove: '',
                    budgetDocument: '',
                    budgetAmount: '',
                    budgetApprove: ''
                }
            }
        },
        methods: {
            //打开弹框
            show(item){
                this.dialogVisible=true
                if(item){
                    this.showForm.projectSetupId = item
                    get(item).then(res=>{
                        if (res.data.code === 0 && res.data.data.epcProjectSetup !== null) {
                            this.showForm = res.data.data.epcProjectSetup
                        } else {
                            this.$message.warning('暂未获取到数据！')
                        }
                    })
                }
            },
            //关闭弹框
            beforeClose(done) {
                this.$emit('beforeClose')
            },
            shutDown(){
                this.$emit('handleClose')
                this.dialogVisible = false
            },
            //对应value取label
            getCardTypeValue(num, sum){
                let arr = sum.filter(e=>e.value === num)
                if (arr.length > 0) {
                    return arr[0].label
                } else {
                    return num
                }
            }
        }
    }
</script>

<style scoped lang="scss">
    @include formWrap(4);
    .card-box {
        position: relative;
        min-height: 55px;
        .handling-opinions {
            padding: 20px;
        }
        .btn {
            position: absolute;
            top: 10px;
            right: 15px;
        }
        .int-text {
            color: #999;
        }
    }
</style>
